﻿Public Class DLDatabase

#Region "Declare"

#End Region

#Region "Event"

#End Region

#Region "Overridable"

    Public Function RestoreDatabase(ByVal serverName As String, ByVal databaseName As String, _
                                    ByVal databasePath As String, ByVal backupfile As String) As Boolean
        Dim bResult As Boolean = True
        'Dim oServer As New SQLDMO.SQLServer
        'With oServer

        'End With
        Return bResult
    End Function

    Public Function GetServerName() As DataTable
        Dim dt As New DataTable
        Dim col As New DataColumn
        'Dim dr As DataRow
        'With col
        '    .ColumnName = "Name"
        '    .DataType = System.Type.GetType("System.String")
        '    dt.Columns.Add(col)
        'End With
        'Dim oServer As New SQLDMO.Application
        'Dim mServerList As SQLDMO.NameList
        'mServerList = oServer.ListAvailableSQLServers()
        'With dt
        '    For iName As Integer = 1 To mServerList.Count
        '        dr = dt.NewRow
        '        dr("Name") = mServerList.Item(iName)
        '        dt.Rows.Add(dr)
        '    Next
        'End With
        Return dt
    End Function

    Public Function GetDatabaseName(ByVal serverName As String, ByVal dbUser As String, ByVal dbPassword As String) _
        As DataTable
        Dim dt As New DataTable
        'Dim col As New DataColumn
        'Dim dr As DataRow
        'With col
        '    .ColumnName = "Name"
        '    .DataType = System.Type.GetType("System.String")
        '    dt.Columns.Add(col)
        'End With
        'Dim oServer As New SQLDMO.SQLServer
        'With oServer
        '    .LoginSecure = True
        '    .Name = serverName
        '    .Login = dbUser
        '    .Password = dbPassword
        '    .Connect()
        'End With
        'With dt
        '    For iName As Integer = 1 To oServer.Databases.Count
        '        If oServer.Databases.Item(iName).Name.ToUpper <> "MASTER" AndAlso oServer.Databases.Item(iName).Name.ToUpper <> "MODEL" AndAlso oServer.Databases.Item(iName).Name.ToUpper <> "MSDB" AndAlso oServer.Databases.Item(iName).Name.ToUpper <> "TEMPDB" Then
        '            dr = dt.NewRow
        '            dr("Name") = oServer.Databases.Item(iName).Name
        '            dt.Rows.Add(dr)
        '        End If
        '    Next
        'End With
        Return dt
    End Function

#End Region

#Region "Sub/Function"

#End Region
End Class
